package main

import "fmt"

func main() {
	user := &User{}
	//baseMethod1(user)
	user.BaseEntityOne.name = "张三"
	user.BaseEntityOne.age = 20
	user.address = "安徽"
	user.BaseMethod1()
	fmt.Println("user:", user)

	b := BaseEntityOne{"测试base", 20}
	b.BaseMethod1()
	test(user.BaseEntityOne)
}

type BaseEntityOne struct {
	name string
	age  int
}

// BaseMethod1 定义BaseEntityOne的方法
func (b BaseEntityOne) BaseMethod1() {
	fmt.Println(b.name)
}

// 定义方法
func test(b BaseEntityOne) {
	fmt.Println(b.name)
}

type User struct {
	// 多继承 or 多重继承
	BaseEntityOne
	address string
}
